﻿using System;
using System.Collections.Generic;

namespace Little.Soldier.SWIFT.Definition
{
  [Serializable]
  internal abstract class SwiftDefinitionElement
  {
    private bool _mandatory = true;
    private List<SwiftDefinitionElement> _elements = new List<SwiftDefinitionElement>();
    private string _name;
    private string _description;
    private int _id;

    public bool Mandatory
    {
      get
      {
        return this._mandatory;
      }
      set
      {
        this._mandatory = value;
      }
    }

    public string Name
    {
      get
      {
        return this._name;
      }
      set
      {
        this._name = value;
      }
    }

    public string Description
    {
      get
      {
        return this._description;
      }
      set
      {
        this._description = value;
      }
    }

    public int Id
    {
      get
      {
        return this._id;
      }
      set
      {
        this._id = value;
      }
    }

    public List<SwiftDefinitionElement> Elements
    {
      get
      {
        return this._elements;
      }
    }

    public SwiftDefinitionElement()
    {
    }

    public SwiftDefinitionElement(string name, string description)
    {
      this._name = name;
      this._description = description;
    }

    public virtual void U008E(SwiftDefinitionElement element)
    {
      this._elements.Add(element);
    }

    public virtual bool U008F(object obj)
    {
      SwiftDefinitionElement definitionElement = obj as SwiftDefinitionElement;
      if (definitionElement == null || this._elements.Count != definitionElement._elements.Count)
        return false;
      for (int index = 0; index < this._elements.Count; ++index)
      {
        if (!this._elements[index].U008F((object) definitionElement._elements[index]))
          return false;
      }
      return true;
    }
  }
}
